package thread;

/**
 * @author tongchen
 * @create 2023-01-04 17:36
 */
public class Statement {
    public static void main(String[] args) {
        Thread thread=new Thread(()->{
            while(true){
                //获取类名
                String className=Statement.class.getName();
                //获取方法名
                String methodName=Thread.currentThread().getStackTrace()[1].getMethodName();
                System.out.println("大圣归来"+className+methodName+Thread.currentThread().getName()
                +Thread.currentThread().getId()+Thread.currentThread().getState()+Thread.currentThread().getPriority()+Thread.currentThread().isDaemon());
                System.out.println(Thread.currentThread().isAlive());
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        },"孙悟空");
        //执行线程
        thread.start();
    }


}
